Remove variables from the platform-independent GDK API
authorTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 12:55:45 +0000 (15:55 +0300)
committerTor Lillqvist <tml@iki.fi>
Wed, 8 Sep 2010 12:59:09 +0000 (15:59 +0300)
gdk_threads_mutex, gdk_threads_lock and gdk_threads_unlock are removed
from public API. gdk_threads_mutex was deprecated already. Instead of
using gdk_threads_lock and _unlock one was presumably supposed to use
the GDK_THREADS_ENTER and _LEAVE macros, which now simply call the
corresponding gdk_threads_enter() and _leave() functions.

Remove he dllimport/dllexport ugliness for GDK for Windows.

There is still a gdk_display variable being exported by the X11
backend.

gdk/gdk.c
gdk/gdk.h
gdk/gdk.symbols
gdk/gdkglobals.c
gdk/gdktypes.h

index 6f494e8b0c3b42aeb85331f1fee91f65508c302c..78d133b69a16d5b68d9fa2f136407521dfcfa7e4 100644 (file)
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -63,6 +63,11 @@ static int gdk_initialized = 0;                          /* 1 if the library is initialized,
 
 static gchar  *gdk_progclass = NULL;
 
+static GMutex *gdk_threads_mutex = NULL;            /* Global GDK lock */
+
+static GCallback gdk_threads_lock = NULL;
+static GCallback gdk_threads_unlock = NULL;
+
 #ifdef G_ENABLE_DEBUG
 static const GDebugKey gdk_debug_keys[] = {
   {"events",       GDK_DEBUG_EVENTS},
@@ -384,13 +389,15 @@ gdk_init (int *argc, char ***argv)
 void
 gdk_threads_enter (void)
 {
-  GDK_THREADS_ENTER ();
+  if (gdk_threads_lock)
+    (*gdk_threads_lock) ();
 }
 
 void
 gdk_threads_leave (void)
 {
-  GDK_THREADS_LEAVE ();
+  if (gdk_threads_unlock)
+    (*gdk_threads_unlock) ();
 }
 
 static void
index d3a0ea8181b02b39117fcdfd2f2bf3f0eef902fb..97381047d28c910eca0926686b92460c4b6586e9 100644 (file)
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -151,13 +151,6 @@ void gdk_notify_startup_complete_with_id (const gchar* startup_id);
 /* Threading
  */
 
-#if !defined (GDK_DISABLE_DEPRECATED) || defined (GDK_COMPILATION)
-GDKVAR GMutex *gdk_threads_mutex; /* private */
-#endif
-
-GDKVAR GCallback gdk_threads_lock;
-GDKVAR GCallback gdk_threads_unlock;
-
 void     gdk_threads_enter                    (void);
 void     gdk_threads_leave                    (void);
 void     gdk_threads_init                     (void);
@@ -187,19 +180,8 @@ guint    gdk_threads_add_timeout_seconds      (guint          interval,
                                                GSourceFunc    function,
                                                gpointer       data);
 
-#ifdef G_THREADS_ENABLED
-#  define GDK_THREADS_ENTER()  G_STMT_START {  \
-      if (gdk_threads_lock)                    \
-        (*gdk_threads_lock) ();                        \
-   } G_STMT_END
-#  define GDK_THREADS_LEAVE()  G_STMT_START {  \
-      if (gdk_threads_unlock)                  \
-        (*gdk_threads_unlock) ();              \
-   } G_STMT_END
-#else  /* !G_THREADS_ENABLED */
-#  define GDK_THREADS_ENTER()
-#  define GDK_THREADS_LEAVE()
-#endif /* !G_THREADS_ENABLED */
+#define GDK_THREADS_ENTER() gdk_threads_enter()
+#define GDK_THREADS_LEAVE() gdk_threads_leave()
 
 G_END_DECLS
 
index acf147074bc93101f5619876a0f609bd40a89a3f..b5e4439c6ef9ec8a3b8da51a193bcbed86722a02 100644 (file)
@@ -1093,12 +1093,6 @@ gdk_window_impl_get_type G_GNUC_CONST
 #endif
 #endif
 
-#ifdef INCLUDE_VARIABLES
-gdk_threads_mutex
-gdk_threads_lock
-gdk_threads_unlock
-#endif
-
 #ifdef GDK_WINDOWING_X11
 #ifdef INCLUDE_VARIABLES
 gdk_display
index e92ad4892ac47178990f16020b77196b5a1f7ab7..b9d86e137d7a9e81d9551747bec3b5298df30d24 100644 (file)
@@ -43,7 +43,3 @@ gboolean            _gdk_native_windows = FALSE;
 gboolean            _gdk_enable_multidevice = FALSE;
 
 GSList             *_gdk_displays = NULL;
-
-GMutex              *gdk_threads_mutex = NULL;          /* Global GDK lock */
-GCallback            gdk_threads_lock = NULL;
-GCallback            gdk_threads_unlock = NULL;
index 8630d7d36488398f86519253511e107866112b99..ab52197d8db775c338ffdf8f273a866e023c3858 100644 (file)
 #include <glib-object.h>
 #include <cairo.h>
 
-#ifdef G_OS_WIN32
-#  ifdef GDK_COMPILATION
-#    define GDKVAR __declspec(dllexport)
-#  else
-#    define GDKVAR extern __declspec(dllimport)
-#  endif
-#else
-#  define GDKVAR extern
-#endif
-
 /* The system specific file gdkconfig.h contains such configuration
  * settings that are needed not only when compiling GDK (or GTK)
  * itself, but also occasionally when compiling programs that use GDK